<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 *订单管理
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return['status']=$this->jiqilog_status;
$tabs=array(
	array('op'=>'list','title'=>'全部记录'),
); 
if($_RQ['op']=='list'){
	$return['params']=array();
	$params=array('uniacid'=>$_SESSION['uniacid'],'merchid'=>$merchid);
	if(isset($_RQ['type']) && $_RQ['type']!=100){
		$params['type']=intval($_RQ['type']);
		$return['params']['type']=intval($_RQ['type']);
	}
	if(isset($_RQ['mid'])){
		$params['mid']=intval($_RQ['mid']);
		$return['params']['mid']=intval($_RQ['mid']);
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$list=pdo_getslice('jy_pingdd_pin_log',$params,array($pindex,$psize),$total,$fields,'','createtime desc');
	if($list){
		foreach($list as $k=>&$item){
			$item['member']=cfc('core')->member_show($item['mid']);
			$pinggoods=pdo_get('jy_pingdd_pin_goods',array('uniacid'=>$_SESSION['uniacid'],'id'=>$item['pingid']));
			$item['goods']=pdo_get('jy_weishop_goods',array('uniacid'=>$_SESSION['uniacid'],'id'=>$pinggoods['goodsid']),array('title','image'));
		}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'tabs'=>$tabs,
		'list'=>array('data'=>'list','del_one'=>false,'delall'=>false,'list'=>array(
			array('name'=>'member','title'=>'会员信息_Member','type'=>'member'),
			array('name'=>'orderid','title'=>'订单ID','type'=>'string'),
			array('name'=>'goods.title','title'=>'拼团商品','type'=>'string'),
			array('name'=>'goods.image','title'=>'拼团商品图片','type'=>'image'),
			//array('name'=>'type','title'=>'类型','type'=>'radio','options'=>'types'),
			array('name'=>'msg','title'=>'备注','type'=>'string'),
			//array('name'=>'dayid','title'=>'日期','type'=>'string'),
			//array('name'=>'times','title'=>'时间段','type'=>'string'),
			array('name'=>'createtime','title'=>'时间','type'=>'time'),
		)),
		'search'=>array(
			array('type'=>'radio','width'=>15,'name'=>'type','options'=>'types','title'=>'类型'),
			array('type'=>'choose','width'=>15,'action'=>'core/member.get_member/','name'=>'mid','title'=>'选择会员'),
		),
	);
	$return['types']=$this->log_type;
	$return['htmls']=$htmls;	
	exi($return);
}
